package com.zhongyu.controller;

import com.zhongyu.util.RedisUtil;
import com.zhongyu.vo.KuaiDiL;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class TestRedisController {
    @Resource
    private RedisUtil redisUtil;
    @GetMapping("/redis/test")
    @ResponseBody
    public String getRedisValue(){
        KuaiDiL kuaiDiL=new KuaiDiL();
        kuaiDiL.setStatus("状态");
        kuaiDiL.setTime("1992-12-23");
        redisUtil.setObj("key01",kuaiDiL);
        KuaiDiL value01= (KuaiDiL) redisUtil.getObj("key01");
        System.out.println(value01);
        return redisUtil.getStr("mykey");
    }
}
